<%@ page contentType="text/html;charset=UTF-8" %>

<html>
<head>
	<title>审计-日志列表</title>
	<%@ include file="/common/meta.jsp" %>
	<%@ include file="/common/import.jsp" %>
	<link rel="stylesheet" type="text/css" href="${ctx}/js/easyui/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="${ctx}/js/easyui/themes/demo.css">
	<script type="text/javascript">
	
		$(function(){
			$('#logList').datagrid({
				title:'审计日志列表',
				iconCls:'icon-ok',
				url:'list!data.action',
				nowrap: false,
				striped: true,
				collapsible:false,				
				fitColumns: true,
				pagination:true,
				singleSelect:true,
				rownumbers:true,
				
				remoteSort: false,
				pageList:[15,20,30,50],
				idField:'logId',
				columns:[[
					{field:'sysEname',title:'所属应用',width:50,sortable:true},
					{field:'unitCname',title:'所属模块名称',width:50,sortable:true},
					{field:'logObj',title:'操作对象',width:50,sortable:true},
					{field:'logTitle',title:'操作概要',width:50,sortable:true},
					{field:'logTimeStr',title:'操作时间',width:50,sortable:true},
					{field:'userEname',title:'操作人账号',width:50,sortable:true},
					{field:'userCname',title:'操作人姓名',width:50,sortable:true},
					{field:'logIp',title:'操作IP或域名',width:50,sortable:true}					
				]],
				onDblClickRow:function(row){
					logView();
				},
				toolbar:[{
					text:'查看详细信息',
					iconCls:'icon-edit',
					handler:function(){
						logView();
					}
				},'-',{
					text:'刷新',
					iconCls:'icon-reload',
					handler:function(){
						$('#logList').datagrid('reload');
					}
				}]
			});
		});
		
		// 查看
		function logView(){
			var node = getSelected();		
			if (node){
				var url = '${ctx}/audit/core/log/view.action?id='+node.logId;
				$('#viewFrame').attr("title",node.logTitle);
				$('#viewFrame').attr("src",url);
				$('#viewDiv').window('open');
			}
		}
		
		// 是否选中
		function getSelected(){
			var selected = $('#logList').datagrid('getSelected');
			if (selected){
				return selected;
			}else{
				$.messager.alert('提示', '请选择要操作的数据', 'info');
			}
		}
		// 查询
		function logQuery(){					
	    	var queryParams = $('#logList').datagrid('options').queryParams;	       
	        queryParams.sysEname = $('#sysEname').combobox('getValue');//$('#sysEname').val();
	        queryParams.unitEname = $('#unitEname').combobox('getValue');//$('#unitEname').val();
	        queryParams.logTitle = $('#logTitle').val();
	        queryParams.userEname = $('#userEname').val();
	        queryParams.logIp = $('#logIp').val();
	        queryParams.spaceEname = $('#spaceEname').val();
	        var options = $('#logList').datagrid('getPager').data("pagination").options;  
	        options.pageNumber=1;  
	        options.total=0;  
	        options.pageSize=15; 
	        $('#logList').datagrid("reload");
       	}
			
		//查询条件：应用和所属模块的2级联动查询
		$(function(){
			$('#sysEname').combobox({
			    url:'${ctx}/audit/core/sys/list-select.action',
			    valueField:'sysEname',
			    textField:'sysCname',
			    onChange :function(){reloadUnit();}
			});
			
			$('#unitEname').combobox({
			    url:'${ctx}/audit/core/unit/list-select.action',
			    valueField:'unitEname',
			    textField:'unitCname'
			});
		});
		
		function reloadUnit(){
			$('#unitEname').combobox('setValue','');
			var sysEname = $('#sysEname').combobox('getValue');		
			var unitUrl='${ctx}/audit/core/unit/list-select.action?sysEname='+sysEname;
			$('#unitEname').combobox('reload',unitUrl);
		}
	</script>
</head>
<body>

	<!-- 查询条件窗口 -->
	<table class="planel-body" width="100%">
		<tr>
			<td>所属应用</td>
		    <td><select id="sysEname" name="sysEname" style="width:200px;"></select></td>
		    <td>所属模块</td>
		    <td><select id="unitEname" name="unitEname" style="width:200px;"></select></td>
		    <td>操作概要</td>
		    <td colspan="2" ><input type="text" name="logTitle"  id="logTitle" /></td>
		</tr>
		<tr>
			<td>操作人账号</td>
		    <td><input type="text" name="userEname"  id="userEname" /></td>
		    <td>操作IP地址</td>
		    <td><input type="text" name="logIp"  id="logIp" /></td>
		    <td>所属空间</td>
		    <td><input type="text" name="spaceEname"  id="spaceEname" /></td>
		    <td align="center">	
				<a class="easyui-linkbutton" iconCls="icon-search"	onclick="logQuery();">查 询</a>
			</td>
		</tr>
	</table>	  
		
	<table id="logList" class="easyui-datagrid" title="审计日志列表" >
		<thead >
			<tr>
				<th data-options="field:'sysEname',width:60">所属应用</th>
				<th data-options="field:'unitEname',width:50">所属模块标识</th>
				<th data-options="field:'unitCname',width:100,align:'right'">所属模块名称</th>
				<th data-options="field:'logObj',width:130,align:'right'">操作对象</th>
				<th data-options="field:'logTitle',width:100">操作概要</th>
				
				<th data-options="field:'logTimeStr',width:150">操作时间</th>
				<th data-options="field:'userEname',width:80">操作人账号</th>
				<th data-options="field:'userCname',width:150">操作人姓名</th>
				<th data-options="field:'deptName',width:150">日志摘要</th>
			</tr>
		</thead>
	</table>
	
	<!-- 日志查看页面 -->
	<div id="viewDiv" class="easyui-window" title="日志内容详情" style="padding:5px;width: 700px;height:400px;"
    	iconCls="icon-search" closed="true" maximizable="false" minimizable="false" collapsible="false">
   	 	<iframe frameborder="0"  id="viewFrame" height="100%" width="100%" scrolling="auto" frameborder="0" ></iframe>
    </div>
     
</body>
</html>